<template>
	<el-row class="content">
		<el-col :xs='24' :sm={span:6,offset:9}>
			<span class="title">注册</span>
			<el-row>
				<form>
						<el-input v-model="account" v-validate="'required'" name="account" placeholder="请输入账号" type="text" autocomplete="off"></el-input>
						<p v-show="errors.has('account')" class="erro">{{ errors.first('account') }}</p>						
						<el-input autocomplete="off" v-validate="'required'" name='password' v-model="password" type="password" placeholder="请输入密码"></el-input>
						<p v-show="errors.has('password')" class="erro">{{ errors.first('password') }}</p>					
						<el-input v-model="repassword" type="password" v-validate="'required'" placeholder="请再次确认密码" name="repassword" autocomplete="off"></el-input>
						<p v-show="errors.has('repassword')" class="erro">{{ errors.first('repassword') }}</p>				
						<el-button type="primary" @click="signin">注册</el-button>
					
				</form>	
			</el-row>
		</el-col>
	</el-row>
</template>
<script>
	export default{
		name:'signin',
		data(){
			return{
				account:'',
				password:'',
				repassword:''
			}
		
		},
		methods:{
			signin(){
				var slef=this;
				this.$validator.validate().then(result => {
					if(result){
					   let obj={
							username:this.account,
							password:this.password
							}
					this.$http.post('/auth/user/signin',obj).then((res)=>{
						if(res.status==200){
							this.$message({
							type:'success',
							message:'注册成功！',
							duration:1500
							})	
							this.$router.replace('/')
						}
					})
				}
				})
				   
			}
		}
	}
	
</script>
<style scoped>
	.title{
		line-height: 45px;
	}
	.el-input{
		margin-top: 20px;
	}
	.el-button{
		width: 100%;
		margin-top: 20px;
	}
	form p{
		line-height: 20px;
		text-align: left;
		margin: 0;
		padding: 0;
		color: #F56C6C;
		font-size: 12px;
	}
</style>